﻿using System.Windows.Forms;
using DevExpress.XtraEditors.Controls;

namespace Medicalsystem.MCP.FormDesigner.Common
{
    /// <summary>
    /// 边框自定义类型与系统类型转换
    /// </summary>
    public static class BorderStyleConvert
    {
        /// <summary>
        /// 转换为系统类型ForWindowsControl
        /// </summary>
        /// <param name="eBorderStyle"></param>
        /// <returns></returns>
        public static BorderStyle ToBorderStyle(EBorderStyle eBorderStyle)
        {
            BorderStyle result = BorderStyle.None;
            switch (eBorderStyle)
            {
                case EBorderStyle.None:
                    result = BorderStyle.None;
                    break;

                case EBorderStyle.FixedSingle:
                    result = BorderStyle.FixedSingle;
                    break;

                case EBorderStyle.Fixed3D:
                    result = BorderStyle.Fixed3D;
                    break;

                case EBorderStyle.UnderLine:
                    result = BorderStyle.None;
                    break;
            }

            return result;
        }

        /// <summary>
        /// 转换为自定义类型ForWindowsControl
        /// </summary>
        /// <param name="borderStyle"></param>
        /// <returns></returns>
        public static EBorderStyle ToEBorderStyle(BorderStyle borderStyle)
        {
            EBorderStyle result = EBorderStyle.None;
            switch (borderStyle)
            {
                case BorderStyle.None:
                    result = EBorderStyle.None;
                    break;

                case BorderStyle.FixedSingle:
                    result = EBorderStyle.FixedSingle;
                    break;

                case BorderStyle.Fixed3D:
                    result = EBorderStyle.Fixed3D;
                    break;
            }
            return result;
        }



        /// <summary>
        /// 转换为系统类型ForDevControl
        /// </summary>
        /// <param name="eBorderStyle"></param>
        /// <returns></returns>
        public static BorderStyles ToBorderStyles(EBorderStyle eBorderStyle)
        {
            BorderStyles result = BorderStyles.NoBorder;
            switch (eBorderStyle)
            {
                case EBorderStyle.None:
                    result = BorderStyles.NoBorder;
                    break;

                case EBorderStyle.Fixed3D:
                    result = BorderStyles.Style3D;
                    break;

                case EBorderStyle.FixedSingle:
                    result = BorderStyles.Simple;
                    break;

                case EBorderStyle.UnderLine:
                    result = BorderStyles.NoBorder;
                    break;
            }

            return result;
        }

        /// <summary>
        /// 转换为自定义类型ForDevControl
        /// </summary>
        /// <param name="borderStyle"></param>
        /// <returns></returns>
        public static EBorderStyle ToEBorderStyle(BorderStyles borderStyle)
        {
            EBorderStyle result = EBorderStyle.None;
            switch (borderStyle)
            {
                case BorderStyles.NoBorder:
                    result = EBorderStyle.None;
                    break;

                case BorderStyles.Simple:
                    result = EBorderStyle.FixedSingle;
                    break;

                case BorderStyles.Style3D:
                    result = EBorderStyle.Fixed3D;
                    break;
            }
            return result;
        }
    }
}